package com.biosimilarity.parallelOgram.model.parallelOgram;

import com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.*;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;

/** BNFC-Generated Fold Visitor */
public abstract class FoldVisitor<R,A> implements AllVisitor<R,A> {
    public abstract R leaf(A arg);
    public abstract R combine(R x, R y, A arg);

/* ProcessExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Mixed p, A arg) {
      R r = leaf(arg);
      r = combine(p.collectionexpr_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Selected p, A arg) {
      R r = leaf(arg);
      r = combine(p.summationexpr_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Engaged p, A arg) {
      R r = leaf(arg);
      r = combine(p.receiveexpr_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Carried p, A arg) {
      R r = leaf(arg);
      r = combine(p.sendexpr_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Served p, A arg) {
      R r = leaf(arg);
      r = combine(p.siteexpr_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Varied p, A arg) {
      R r = leaf(arg);
      r = combine(p.processvar_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Emptied p, A arg) {
      R r = leaf(arg);
      return r;
    }

/* CollectionExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.CollectedExtension p, A arg) {
      R r = leaf(arg);
      for (ProcessExpr x : p.listprocessexpr_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.CollectedIntension p, A arg) {
      R r = leaf(arg);
      r = combine(p.processptn_.accept(this, arg), r, arg);
      for (ProcessDeclOrCond x : p.listprocessdeclorcond_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* SummationExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Switched p, A arg) {
      R r = leaf(arg);
      r = combine(p.summationbody_.accept(this, arg), r, arg);
      return r;
    }

/* SummationBody */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SwitchedExtension p, A arg) {
      R r = leaf(arg);
      for (ReceiveExpr x : p.listreceiveexpr_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SwitchedIntension p, A arg) {
      R r = leaf(arg);
      r = combine(p.guardedptn_.accept(this, arg), r, arg);
      for (GuardedDeclOrCond x : p.listguardeddeclorcond_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* ReceiveExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Synched p, A arg) {
      R r = leaf(arg);
      r = combine(p.siteexpr_.accept(this, arg), r, arg);
      r = combine(p.abstractionexpr_.accept(this, arg), r, arg);
      return r;
    }

/* SendExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.CoSynched p, A arg) {
      R r = leaf(arg);
      r = combine(p.siteexpr_.accept(this, arg), r, arg);
      r = combine(p.informationexpr_.accept(this, arg), r, arg);
      return r;
    }

/* AbstractionExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Abstracted p, A arg) {
      R r = leaf(arg);
      r = combine(p.exchangeformals_.accept(this, arg), r, arg);
      r = combine(p.processexpr_.accept(this, arg), r, arg);
      return r;
    }

/* InformationExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Manifested p, A arg) {
      R r = leaf(arg);
      for (ExchangeExpr x : p.listexchangeexpr_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* ExchangeFormals */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ExchangeFormalSpec p, A arg) {
      R r = leaf(arg);
      for (ExchangeExpr x : p.listexchangeexpr_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* ProcessPtn */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.MixtureDestructed p, A arg) {
      R r = leaf(arg);
      for (ProcessPtn x : p.listprocessptn_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SelectionDestructed p, A arg) {
      R r = leaf(arg);
      r = combine(p.selectionbodyptn_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ReceiveDestructed p, A arg) {
      R r = leaf(arg);
      r = combine(p.guardedptn_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SendDestructed p, A arg) {
      R r = leaf(arg);
      r = combine(p.siteptn_.accept(this, arg), r, arg);
      r = combine(p.informationptn_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ServeDestructed p, A arg) {
      R r = leaf(arg);
      r = combine(p.selectionbodyptn_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessPtnLiteral p, A arg) {
      R r = leaf(arg);
      r = combine(p.processexpr_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessPtnPVar p, A arg) {
      R r = leaf(arg);
      r = combine(p.processvar_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessPtnWild p, A arg) {
      R r = leaf(arg);
      return r;
    }

/* SelectionBodyPtn */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SelectBodyDestruct p, A arg) {
      R r = leaf(arg);
      for (GuardedPtn x : p.listguardedptn_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* GuardedPtn */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.GuardedDestruct p, A arg) {
      R r = leaf(arg);
      r = combine(p.siteptn_.accept(this, arg), r, arg);
      r = combine(p.abstractionptn_.accept(this, arg), r, arg);
      return r;
    }

/* InformationPtn */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.InformationDestruct p, A arg) {
      R r = leaf(arg);
      for (ProcessPtn x : p.listprocessptn_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* AbstractionPtn */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.AbstractionDestruct p, A arg) {
      R r = leaf(arg);
      r = combine(p.formalsptn_.accept(this, arg), r, arg);
      r = combine(p.processptn_.accept(this, arg), r, arg);
      return r;
    }

/* SitePtn */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SiteQuotePtn p, A arg) {
      R r = leaf(arg);
      r = combine(p.processptn_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SiteVarPtn p, A arg) {
      R r = leaf(arg);
      r = combine(p.sitevar_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SiteWildPtn p, A arg) {
      R r = leaf(arg);
      return r;
    }

/* FormalsPtn */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.FormalsDestruct p, A arg) {
      R r = leaf(arg);
      for (PtnPtn x : p.listptnptn_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* PtnPtn */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.PtnLiteralDestruct p, A arg) {
      R r = leaf(arg);
      r = combine(p.processptn_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.PtnVarDestruct p, A arg) {
      R r = leaf(arg);
      return r;
    }

/* ExchangeExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Substituted p, A arg) {
      R r = leaf(arg);
      r = combine(p.processptn_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Variable p, A arg) {
      R r = leaf(arg);
      r = combine(p.sitevar_.accept(this, arg), r, arg);
      return r;
    }

/* ProcessDeclOrCond */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessRequired p, A arg) {
      R r = leaf(arg);
      r = combine(p.processcondition_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessGenerated p, A arg) {
      R r = leaf(arg);
      r = combine(p.processgenerator_.accept(this, arg), r, arg);
      return r;
    }

/* ProcessGenerator */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessGenExpr p, A arg) {
      R r = leaf(arg);
      r = combine(p.processptn_.accept(this, arg), r, arg);
      r = combine(p.processexpr_.accept(this, arg), r, arg);
      return r;
    }

/* ProcessCondition */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessReqExpr p, A arg) {
      R r = leaf(arg);
      r = combine(p.processptn_.accept(this, arg), r, arg);
      r = combine(p.processproperty_.accept(this, arg), r, arg);
      return r;
    }

/* GuardedDeclOrCond */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.GuardedRequired p, A arg) {
      R r = leaf(arg);
      r = combine(p.guardedcondition_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.GuardedGenerated p, A arg) {
      R r = leaf(arg);
      r = combine(p.guardedgenerator_.accept(this, arg), r, arg);
      return r;
    }

/* GuardedGenerator */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.GuardedGenExpr p, A arg) {
      R r = leaf(arg);
      r = combine(p.guardedptn_.accept(this, arg), r, arg);
      r = combine(p.receiveexpr_.accept(this, arg), r, arg);
      return r;
    }

/* GuardedCondition */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.GuardedReqExpr p, A arg) {
      R r = leaf(arg);
      r = combine(p.guardedptn_.accept(this, arg), r, arg);
      r = combine(p.guardedshape_.accept(this, arg), r, arg);
      return r;
    }

/* ProcessProperty */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessDisjunction p, A arg) {
      R r = leaf(arg);
      r = combine(p.processproperty_1.accept(this, arg), r, arg);
      r = combine(p.processproperty_2.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessConjunction p, A arg) {
      R r = leaf(arg);
      r = combine(p.processproperty_1.accept(this, arg), r, arg);
      r = combine(p.processproperty_2.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessNegation p, A arg) {
      R r = leaf(arg);
      r = combine(p.processproperty_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessStructure p, A arg) {
      R r = leaf(arg);
      r = combine(p.processshape_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessGround p, A arg) {
      R r = leaf(arg);
      r = combine(p.groundprocessproperty_.accept(this, arg), r, arg);
      return r;
    }

/* ProcessShape */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.MixtureProp p, A arg) {
      R r = leaf(arg);
      for (ProcessProperty x : p.listprocessproperty_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ReceiveProp p, A arg) {
      R r = leaf(arg);
      r = combine(p.guardedshape_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SendProp p, A arg) {
      R r = leaf(arg);
      r = combine(p.siteprop_.accept(this, arg), r, arg);
      r = combine(p.informationshape_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ServeProp p, A arg) {
      R r = leaf(arg);
      r = combine(p.selectionbodyshape_.accept(this, arg), r, arg);
      return r;
    }

/* InformationShape */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.DataShape p, A arg) {
      R r = leaf(arg);
      for (ProcessProperty x : p.listprocessproperty_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* SelectionBodyShape */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SelectBodyProp p, A arg) {
      R r = leaf(arg);
      for (GuardedShape x : p.listguardedshape_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* GuardedShape */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.GuardedProp p, A arg) {
      R r = leaf(arg);
      r = combine(p.siteprop_.accept(this, arg), r, arg);
      r = combine(p.abstractionprop_.accept(this, arg), r, arg);
      return r;
    }

/* AbstractionProp */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.AbstractedProp p, A arg) {
      R r = leaf(arg);
      r = combine(p.formalsprop_.accept(this, arg), r, arg);
      r = combine(p.processproperty_.accept(this, arg), r, arg);
      return r;
    }

/* SiteProp */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SiteShape p, A arg) {
      R r = leaf(arg);
      r = combine(p.processproperty_.accept(this, arg), r, arg);
      return r;
    }

/* FormalsProp */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ParamsProp p, A arg) {
      R r = leaf(arg);
      for (FormalProp x : p.listformalprop_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* FormalProp */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ParamIdentProp p, A arg) {
      R r = leaf(arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ParamShapeProp p, A arg) {
      R r = leaf(arg);
      r = combine(p.siteprop_.accept(this, arg), r, arg);
      return r;
    }

/* GroundProcessProperty */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessLogicGround p, A arg) {
      R r = leaf(arg);
      r = combine(p.logicalground_.accept(this, arg), r, arg);
      return r;
    }

/* LogicalGround */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Verity p, A arg) {
      R r = leaf(arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Absurdity p, A arg) {
      R r = leaf(arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.Nullity p, A arg) {
      R r = leaf(arg);
      return r;
    }

/* SiteExpr */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SiteIdent p, A arg) {
      R r = leaf(arg);
      return r;
    }
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SiteQuotation p, A arg) {
      R r = leaf(arg);
      r = combine(p.processexpr_.accept(this, arg), r, arg);
      return r;
    }

/* SiteVar */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.SiteVarIdent p, A arg) {
      R r = leaf(arg);
      return r;
    }

/* ProcessVar */
    public R visit(com.biosimilarity.parallelOgram.model.parallelOgram.Absyn.ProcessIdent p, A arg) {
      R r = leaf(arg);
      return r;
    }


}
